#ifndef _KEYBOARD_QUEUE_H_
#define _KEYBOARD_QUEUE_H_

#include "utypes.h"

/*
 * Queue definition
 */
typedef struct {
    char buf[16]; // array which the queue is based on
    int in;		    // index on array where to put next element
    int out;		  // index on array where to get next element from
    int cnt;		  // current number of elements in the queue
    int size;		  // queue capacity
} Queue;

/*
 * Initialize the queue
 */
void queueInit(volatile Queue *q);

/* 
 * Put char 'c' in the queue pointed to by 'q'
 * Returns false if operation failed (the queue is full)
 */
bool_t queuePut(volatile Queue *q, char c);

/*
 * Get next element from queue
 *  Returns -1 (an int) if there are no elements in the queue
 */
char queueGet(volatile Queue *q);

/*
 * Returns true if the queue is empty
 */
bool_t queueEmpty(volatile Queue *q);

/*
 * Returns true if the queue if full
 */
bool_t queueFull(volatile Queue *q);

#endif /* _KEYBOARD_QUEUE_H_ */
